export const UserRules = {
    name: [
        {required: true, message: '请填写姓名', trigger: 'blur'},
    ],
    gender: [
        {required: true, message: '请选择性别', trigger: 'change'},
    ],
    telephoneNumber: [
        {required: true, message: '请填写电话号码', trigger: 'blur'},
        {pattern: /^(\d{7})|(\d{11})$/, message: '电话号码应为7位或11位数字', trigger: 'blur'},
    ],
    CN_ID: [
        {required: true, message: '请填写身份证号码', trigger: 'blur'},
        {
            pattern: /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])\d{3}[\dXx]$/,
            message: '请输入有效的中国身份证号码',
            trigger: 'blur'
        },
    ],
    username: [
        {required: true, message: '请填写用户名', trigger: 'blur'},
    ],
    email: [
        {required: true, message: '请填写邮箱地址', trigger: 'blur'},
        {pattern: /^[\w.-]+@[\w-]+(\.[\w-]+)+$/ , message: '请输入有效的邮箱地址', trigger: 'blur'},
    ],
    permission: [
        {required: true, message: '请选择身份', trigger: 'change'},
    ],
    password: [
        {required: true, message: '请设置密码', trigger: 'blur'},
        {min: 6, max: 20, message: '密码长度应在6到20个字符之间', trigger: 'blur'},
    ],
    address: [
        {required: true, message: '请填写地址', trigger: 'blur'},
        {
            pattern: /^(?:\d{1,2}-)?\d{3}-\d{3}$/,
            message: '地址格式应为xx-yyy (xx为楼栋号(1-99之间), yyy是房间号(第一个101-999之间))',
            trigger: 'blur'
        },
    ],
    remark: [
        {max: 200, message: '备注不能超过200个字符', trigger: 'blur'},
    ],
};


